package com.veo.dao;

import com.veo.bean.Account;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.mapping.FetchType;

import java.util.List;

public interface AccountDao {


    @Select("select * from account")
    @Results(id = "accountMap",value = {
            @Result(id = true,column = "aid",property = "aid"),
            @Result(column = "uid",property = "uid"),
            @Result(column = "money",property = "money"),
            @Result(column = "uid",property = "user",one = @One(select = "com.veo.dao.UserDao.findById",fetchType = FetchType.LAZY))
    })
    List<Account> findAll();



    @Select("select * from account where uid = #{id}")
    Account findById(int id);
}
